﻿using PhuLeBooze.UICode;
using PhuLeBussinessObject.Product;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PhuLeBooze
{
    public partial class ucCategory : System.Web.UI.UserControl
    {
     
        protected void Page_Load(object sender, EventArgs e)
        {
            String hostName ="";
            CProductTypeUI ui = new CProductTypeUI();
            IList<CProductType> listProductType = ui.GetList();
            string partern = "<div class=\"item {0}\">"
                               + "<div class=\"sphot\">"
                                            + "<ul>{1} </ul>"
                                + "</div>"
                            + "</div>";
            List<CProductType> list = new List<CProductType>();
            string active = " active";
            string ulHtml = "";
            if (listProductType != null)
            {
                foreach (CProductType item in listProductType)
                {
                    list.Add(item);
                }
                for (int i = 0; i < list.Count; i++)
                {
                    string liHtml = "";
                    int i4 = i + 4;
                    for (int j = i; j < list.Count && j < i4; i++, j++)
                    {
                        liHtml += string.Format("<li><a href=\"/procuctdetail/{1}\" title=\"{2}\" class='procuctdetail'><img src=\"{3}\" /></a></li>", hostName, list[j].ID, list[j].NameVN, list[j].Thumbnail);
                    }
                    ulHtml += string.Format(partern, active, liHtml);
                    active = "";
                }

            }
            ltrDetail.Text = ulHtml;
        }
    }
}